package com.linln.admin.pres.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.linln.common.enums.StatusEnum;
import com.linln.common.utils.StatusUtil;
import com.linln.modules.system.domain.User;
import lombok.Data;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * @author wh
 * @date 2024/03/27
 */
@Data
@Entity
@Table(name="db_prescriptions_info")
@EntityListeners(AuditingEntityListener.class)
@Where(clause = StatusUtil.NOT_DELETE)
public class PrescriptionsInfo implements Serializable {
    // 主键
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private Integer id;
    // 来源ID
    private Integer originId;

    private String name;
    // 别名
    private String alias;
    // 出处
    private String provenance;
    // 分类
    private String classification;
    // 功用
    private String jfunction;
    // 主治
    private String jattending;
    // 趣味记忆
    private String memories;
    // 歌诀
    private String rhymeFormulas;
    // 组成
    private String zcomposition;
    // 用法用量
    private String usages;
    // 制法
    private String saute;
    // 功用
    private String zfunction;
    // 主治
    private String zattending;
    // 方义
    private String fangyi;
    // 配伍特点
    private String comFeatures;
    // 运用
    private String apply;
    // 加减化裁
    private String cut;
    // 使用注意
    private String useAttention;
    // 化裁方之间的鉴别
    private String identification;
    // 重要文献摘要
    private String abstracts;
    // 简介
    private String intro;
    // 各家论述
    private String discourse;
    // 注意事项
    private String considerations;
    // 成分
    private String jcomposition;
    // 标题
    private String title;
    // 关键词
    private String keywords;
    // 描述
    private String description;
    // 备注
    private String remark;
    // 创建时间
    @CreatedDate
    private Date createDate;
    // 更新时间
    @LastModifiedDate
    private Date updateDate;
    // 创建者
    @CreatedBy
    @ManyToOne(fetch=FetchType.LAZY)
    @NotFound(action=NotFoundAction.IGNORE)
    @JoinColumn(name="create_by")
    @JsonIgnore
    private User createBy;
    // 更新者
    @LastModifiedBy
    @ManyToOne(fetch=FetchType.LAZY)
    @NotFound(action=NotFoundAction.IGNORE)
    @JoinColumn(name="update_by")
    @JsonIgnore
    private User updateBy;
    // 数据状态
    private Byte status = StatusEnum.OK.getCode();
}